import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsString } from 'class-validator';
import { BasePaginationDto } from '@nbase/nest-mods';
import { IQueryMenu } from '@nbase/shared';

/**
 * 查询菜单 DTO
 */
export class QueryMenuDto extends BasePaginationDto implements IQueryMenu {
  // 菜单默认升序（覆盖基类的 desc）
  @ApiPropertyOptional({
    description: '排序方式',
    example: 'asc',
    enum: ['asc', 'desc'],
    default: 'asc',
  })
  override sortOrder?: 'asc' | 'desc' = 'asc';

  @ApiPropertyOptional({
    description: '菜单名称关键词',
    example: '系统',
  })
  @IsOptional()
  @IsString()
  name?: string;
}

